package cm.day04;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入您的生日，格式：yyyy-MM-dd");
        String num=sc.next();
        DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate localDate=LocalDate.parse(num,df);
        System.out.println(localDate);
        Period period=Period.between(localDate,LocalDate.now());
        int y= period.getYears();
        int m= period.getMonths();
        int d= period.getDays();
        System.out.println("您已经活了："+y+"年零"+m+"月零"+d+"天了");
    }
}
